<!--
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * @Date: 2022-04-07 20:18:30
 * @LastEditors: Sam
 * @LastEditTime: 2022-04-08 17:32:54
-->
<template>
    <div class="app-container">
        <el-card>
            <div slot="header" class="clearfix">
                <span>[NAME]列表</span>
            </div>
             <div class="filter-container">
[WHEREITEM]
                <el-button v-waves  class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">
                {{ '搜索' }}
                </el-button>
[CREATEBUTTON]
[BATCHBUTTON]
[EXPORTBUTTON]
[IMPORTBUTTON]
            </div>
             <el-table
                :header-cell-style="{background:'#eef1f6',color:'#606266'}"
                :data="list"
                border
                fit
                [INDEXBATCH]
                highlight-current-row
                style="width: 100%"
                size="mini"
                >  
                [BATCHSELECT]
                [TABLE_ITEM]
                <el-table-column align="center" width="250" :label="'操作'">
                <template slot-scope="scope">
                    [DETAILBUTTON]
                    [EDITBUTTON]
                    [DELETEBUTTON]
                </template>
                </el-table-column>
            </el-table>

            <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
        </el-card>
        [DETAILDIALOG]
        [EDITLDIALOG]
        [CREATEDIALOG]
    </div>
</template>
<script>
    import waves from '@/directive/waves' // waves directive
    import permission from '@/directive/permission/index.js' // 权限判断指令
    import checkPermission from '@/utils/permission' // 权限判断函数
    import { list, detail, del } from '@/api/[CONTROLLER]' // api接口
    import { parseTime } from '@/utils' // 时间格式化函数
    import { getToken } from '@/utils/auth' // 获取token
    import Pagination from '@/components/Pagination' // 分页组件
[IMPORT]
    export default{
        name: '[CONTROLLER]Index',
        components: { Pagination,[INDEXCOMPONENTS] }, // 引入组件
        filters: {
            parseTime // 时间过滤器
        },
        directives: { waves, permission }, // 引入指令
          data() {
            return {
             headerObj: {
                'Authorization': 'Bearer ' + getToken()
            },
            list: [], // 列表数据
            total: 0, // 总条数
            select_ids : [], // 选中的id集合
            listQuery: { //列表查询参数
                page: 1,
                limit: 10
            },
             [INDEXDATA]
            }
        },
          created() {
            this.getList()
        },
        methods: {
            checkPermission, // 权限判断函数
            handleFilter() { // 查询
                this.listQuery.page = 1
                this.getList()
            },
            getList() { // 获取列表
                list(this.listQuery).then(response => {
                        this.list = response.data.data
                        this.total = response.data.total
                    })
                },
[INDEXMETHODS]
            }
    }
</script>

